package com.ibeeking.gmc.global.g.rest.controller.v1.feign;

import com.ibeeking.gmc.global.g.rest.service.IMsgBaseCodeService;
import com.ibeeking.found.common.entity.MsgBaseCodeDTO;
import com.ibeeking.gmc.global.api.common.query.MsgBaseCodeFeignQuery;
import com.ibeeking.nematos.constants.enums.OperateLogTypeEnum;
import com.ibeeking.nematos.log.annotation.Log;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName MsgBaseInfoController控制器
 * @Description
 * @Author ibeeking
 * @Date 2022-01-05 14:41
 **/
@RestController
@RequestMapping("/g/msgBaseCode/feign/v1")
public class MsgBaseCodeController {

    @Resource
    private IMsgBaseCodeService msgBaseInfoServiceImpl;

    @Log(logType = OperateLogTypeEnum.QUERY, describe = "查询消息基本信息列表")
    @PostMapping(value = "/queryMsgBaseCodeList")
    public List<MsgBaseCodeDTO> queryMsgBaseCodeList(@RequestBody MsgBaseCodeFeignQuery query) {
        return msgBaseInfoServiceImpl.dtoList(query);
    }


    @Log(logType = OperateLogTypeEnum.QUERY, describe = "根据查询消息基本信息")
    @PostMapping(value = "/queryMsgBaseCodeDtoById/{id}")
    public MsgBaseCodeDTO queryMsgBaseCodeDtoById(@PathVariable("id") Long id) {
        return msgBaseInfoServiceImpl.selDtoById(id);
    }

    @Log(logType = OperateLogTypeEnum.QUERY, describe = "根据编码查询消息基本信息")
    @PostMapping(value = "/queryMsgBaseCodeDtoByCode/{code}")
    public MsgBaseCodeDTO queryMsgBaseCodeDtoByCode(@PathVariable("code") String code) {
        return msgBaseInfoServiceImpl.selDtoByCode(code);
    }


}
